package com.gem.day03.exercise;

import java.util.Scanner;

/**
 * 一个5位数，判断它是不是回文数。
 * 即12321是回文数，个位与万位相同，十位与千位相同，用java代码描述
 */
public class Exercise3 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请您输入一个五位数: ");
		int number = scanner.nextInt();
		if (number < 10000 || number >= 100000) {
			System.err.println("非法参数: " + number);
		} else {
			//if (new StringBuilder(number + "").reverse().toString().equals(number + "")) {

			//获取个,十,千,万位
			int g = number % 10;
			int s = number / 10 % 10;
			int q = number % 10000 / 1000;
			int w = number / 10000;
			if (g == w && s == q) {
				System.out.println(number + "是回文数.");
			} else {
				System.err.println(number + "不是回文数.");
			}
		}
		scanner.close();
	}
}
